Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

frontend Sidebar: Improve performance by moving isSelected logic to the parent component #2638

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sniok
Copy link
Contributor

@sniok sniok commented Dec 5, 2024

With this change only items that were updated will rerender

@sniok sniok force-pushed the sidebar-perf branch 2 times, most recently from 6b65c95 to 11382dd Compare December 12, 2024 13:29
@sniok sniok marked this pull request as ready for review December 12, 2024 14:57
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Dec 12, 2024
@illume illume added frontend Issues related to the frontend performance labels Dec 30, 2024
Copy link
Collaborator

@illume illume left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

I left some notes.

Can you please leave in the PR description how to test?

@@ -14,7 +14,7 @@ import { SidebarEntry } from './sidebarSlice';
*/
export interface SidebarItemProps extends ListItemProps, SidebarEntry {
/** The route name which is selected. */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation should be updated as well.

>
<a
class="MuiButtonBase-root MuiListItem-root MuiListItem-gutters MuiListItem-padding MuiListItem-button css-sayhe9-MuiButtonBase-root-MuiListItem-root"
class="MuiButtonBase-root MuiListItem-root MuiListItem-gutters MuiListItem-padding MuiListItem-button Mui-selected css-sayhe9-MuiButtonBase-root-MuiListItem-root"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please explain why this test result changed? I don't see any mention of why, so I'm wondering if it's intentional or a bug?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I incorrectly updated the story for this case. It's fixed now

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Jan 2, 2025
Change logic that determines if the item is selected to the parent
component. This allows for better memoization of individual items.

Signed-off-by: Oleksandr Dubenko <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend Issues related to the frontend performance size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants